home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-03 | 3.9 KB | 175 lines | [TEXT/MMCC] |
- // CAMReminderApp.cp -- application methods
- // Created 01/01/95 12:01 PM by AppMaker
-
- #include "CAMReminderApp.h"
-
- #include "CAMReminderDoc.h"
- #include "CMainWindow.h"
- #include "CAdd.h"
-
- #include <UDesktop.h>
- #include <URegistrar.h>
- #include <UScreenPort.h>
- #include <PPobClasses.h>
- #include <PP_Messages.h>
-
- // ---------------------------------------------------------------------------
- // • CAMReminderApp
- // ---------------------------------------------------------------------------
- // Default constructor
-
- CAMReminderApp::CAMReminderApp()
- :LDocApplication()
- {
- UScreenPort::Initialize();
-
- RegisterClasses();
-
- SetUpMenus();
-
- // initialize app's data members:
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~CAMReminderApp
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- CAMReminderApp::~CAMReminderApp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • RegisterClasses
- // ---------------------------------------------------------------------------
- //
-
- void
- CAMReminderApp::RegisterClasses()
- {
- RegisterAllPPClasses();
- // replace to register only classes that we use.
- // windows know what classes they use
- // so call static functions in each window/dialog,
- // or generate a single function as union of all w/d's.
-
- // register custom pane classes
- URegistrar::RegisterClass('Main', (ClassCreatorFunc)CMainWindow::CreateMainWindowStream);
- URegistrar::RegisterClass('Add ', (ClassCreatorFunc)CAdd::CreateAddStream);
- }
-
- // ---------------------------------------------------------------------------
- // • SetUpMenus
- // ---------------------------------------------------------------------------
- //
-
- void
- CAMReminderApp::SetUpMenus()
- {
-
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
- // The application calls this member function automatically when the application
- // is opened
-
- void
- CAMReminderApp::StartUp()
- {
- ObeyCommand(cmd_New, nil);
- }
-
- //----------
- LModelObject*
- CAMReminderApp::MakeNewDocument()
- {
- CAMReminderDoc *theDoc = new CAMReminderDoc(this);
-
- return theDoc;
- }
-
- //----------
- void
- CAMReminderApp::OpenDocument(
- FSSpec *inMacFSSpec)
- {
- CAMReminderDoc *theDoc = new CAMReminderDoc(this, inMacFSSpec);
- }
-
- //----------
- void
- CAMReminderApp::ChooseDocument()
- {
- SFTypeList typeList;
- short numTypes;
- StandardFileReply macFileReply;
-
- typeList[0] = 'TEXT';
- numTypes = 1;
-
- UDesktop::Deactivate();
- ::StandardGetFile(nil, numTypes, typeList, &macFileReply);
- UDesktop::Activate();
-
- if (macFileReply.sfGood) {
- OpenDocument(&macFileReply.sfFile);
- }
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- CAMReminderApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
- // Remember to add same cases to FindCommandStatus below
- // to enable/disable the menu items for the commands
-
- default:
- cmdHandled = LDocApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // Pass back status of a (menu) command
-
- void
- CAMReminderApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
- // +++ Add cases here for the commands you handle
-
- default:
- LDocApplication::FindCommandStatus(inCommand, outEnabled, outUsesMark,
- outMark, outName);
- break;
- }
- }
-